<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>新增商品</h2>
    </div>
    <form action="{:U(Goods/add)}" method="post" class="form-horizontal" enctype="multipart/form-data">
        <div class="form-item">
            <label class="item-label">商品名<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="title" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">商品分类<span class="check-tips"></span></label>
            <div class="controls select">
            <select name="cid" class="first_select">
                    <option value="" >请选择</option>
            	<foreach name="classify" item="v">
                    <option value="{$v['id']}" >{$v.title}</option>
                </foreach>
            </select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">描述<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="content" value="">
            </div>
        </div>
        <div class="form-item">
			<button class="btn submit-btn" type="submit" target-form="form-horizontal">确 定</button>
			<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('Goods/goods')}');

        $(function(){   
            $(".select").on("change","select",function(){
                sel = $(this);
                var id = sel.val();
                $.ajax({
                       type: "GET",
                       url: "{:U('ajaxSelect')}",
                       data: {id:id},
                       success: function(msg){
                            if(msg.status=1){
                            sel.nextAll().remove();
                            $('.select').append(msg.data);   
                        }
                       }
                    });
            });
        });
    </script>
</block>
